<template>
  <div class="t-radio">
    <el-radio
      v-for="item in options"
      :key="item.value"
      v-model="moduleValue"
      :label="item.value"
      :disabled="disabled"
      @input="handleChange"
      >{{ item.label }}</el-radio
    >
  </div>
</template>
<script>
export default {
  name: "TRadio",
  props: {
    value: {
      type: [String, Number],
      default: "",
      require: true,
    },
    options: {
      type: Array,
      default: () => [],
    },
    disabled: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {};
  },
  computed: {
    moduleValue: {
      get() {
        return this.value;
      },
      set(val) {
        this.$emit("input", val);
      },
    },
  },
  methods: {
    focus() {
      const select = this.$refs.select;
      if (select) {
        select.focus();
      }
    },
    handleChange(value) {
      this.$emit("change", value);
    },
  },
};
</script>
<style lang="scss" scoped>
.t-radio {
  display: flex;
  justify-content: space-around;
  .el-radio {
    margin-right: 5px;
  }
}
</style>
